package com.ysd.lis.controller.sys;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.SysParamField;
import com.ysd.lis.request.SysParamDto;
import com.ysd.lis.request.SysParamFieldParam;
import com.ysd.lis.service.SysParamFieldService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author prs
 * @since 2023-10-19
 */
@Api(tags = "系统参数字段")
@RestController
@RequestMapping("/api/sys/sysParamField")
public class SysParamFieldController extends BaseController {
    @Autowired
    SysParamFieldService sysParamFieldService;

    @ApiOperation("查询")
    @GetMapping("/findSysParamGroupList")
    public Result findSysParamGroupList(SysParamFieldParam param){
        return sysParamFieldService.findSysParamGroupList(param);
    }
    @ApiOperation("查询")
    @GetMapping("/findSysParamFieldList")
    public Result findSysParamFieldList(SysParamFieldParam param) throws JsonProcessingException {
        return sysParamFieldService.findSysParamFieldList(param);
    }

    @ApiOperation("修改")
    @PostMapping("/saveSysParamFieldList")
    @LogDetail(requestParam ="saveSysParamFieldList",operationType = OperationType.INSERT, module = "批量更新系统参数组件属性",content = "通过系统参数设置模块，增加参数组件属性", businessName = "name")
    public Result saveSysParamFieldList(@RequestBody SysParamDto dto) throws JsonProcessingException {
        return sysParamFieldService.saveSysParamFieldList(dto);
    }

    @ApiOperation("新增")
    @PostMapping("/addSysParamField")
    @LogDetail(requestParam ="addSysParamField",operationType = OperationType.INSERT, module = "新增系统参数分组",content = "通过系统参数设置模块，增加【title】参数分组", businessName = "title")
    public Result addSysParamField(@RequestBody SysParamField field){
        return  sysParamFieldService.addSysParamField(field);
    }

    @ApiOperation("修改")
    @PostMapping("/editSysParamField")
    @LogDetail(requestParam ="editSysParamField",operationType = OperationType.UPDATE, module = "修改系统参数分组",content = "通过系统参数设置模块，编辑【title】参数", businessName = "title")
    public Result editSysParamField(@RequestBody SysParamField field) {
        return sysParamFieldService.editSysParamField(field);
    }

    @ApiOperation("根据详情id删除详情数据")
    @PostMapping("/deleteSysParamField")
    @LogDetail(requestParam ="deleteSysParamField",operationType = OperationType.DELETE, module = "删除系统参数分组",content = "通过系统参数设置模块，删除【title】参数", businessName = "title")
    public Result deleteSysParamField(@RequestBody SysParamField field) {
        return sysParamFieldService.deleteSysParamField(field);
    }
}
